#include <scheme.h>

#include "xobject.h"

long xobject_addref(void * atom)
{
	long retval;
 
	retval = atomic_inc_return(&((XOBJECT *)atom)->lRefCount);
 
	return retval;
}

long xobject_release(void * atom)
{
	long retval;
 
	retval = atomic_dec_return(&((XOBJECT *)atom)->lRefCount);
 
	if(0 == retval){
		if(((XOBJECT *)atom)->destroyPtr){
			((XOBJECT *)atom)->destroyPtr(atom);
		}
	}
	return retval;
}
